// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.core.skinnedmodel.advancedanimation;

import zombie.core.math.PZMath;

public final class AnimationVariableSlotFloat extends AnimationVariableSlot {
    private float m_value = 0.0F;

    public AnimationVariableSlotFloat(String key) {
        super(key);
    }

    @Override
    public String getValueString() {
        return String.valueOf(this.m_value);
    }

    @Override
    public float getValueFloat() {
        return this.m_value;
    }

    @Override
    public boolean getValueBool() {
        return this.m_value != 0.0F;
    }

    @Override
    public void setValue(String val) {
        this.m_value = PZMath.tryParseFloat(val, 0.0F);
    }

    @Override
    public void setValue(float val) {
        this.m_value = val;
    }

    @Override
    public void setValue(boolean val) {
        this.m_value = val ? 1.0F : 0.0F;
    }

    @Override
    public AnimationVariableType getType() {
        return AnimationVariableType.Float;
    }

    @Override
    public boolean canConvertFrom(String val) {
        return PZMath.canParseFloat(val);
    }

    @Override
    public void clear() {
        this.m_value = 0.0F;
    }
}
